% saves given connectome into a text file (path to the file
% is given as a parameter). Function also adds to the text file
% connectomeName, which could be name or short description for saved
% connectome.
function saveConnectomeToFile( connectome, connectomeName, filePath )
    fileID = fopen(filePath,'w');
    fprintf(fileID,'ConnectomesName: %s\n',connectomeName);
    fprintf(fileID,'InputSize: %i\n',connectome.inputSize);
    fprintf(fileID,'OutputSize: %i\n',connectome.outputSize);
    fprintf(fileID,'MaximalNumberOfNeuronsInLayer: %i\n', connectome.maximalNumberOfNeuronsInLayer);
    fprintf(fileID,'NumberOfLayers: %i\n',connectome.numberOfLayers);
    fprintf(fileID,'NeuronInLayerVector: ');
    fprintf(fileID,'%i ',connectome.neuronInLayerVector);
    fprintf(fileID,'\n');
    fprintf(fileID,'Neurons: %i\n', length(connectome.neurons));
    for i=1:length(connectome.neurons)
        neuron = connectome.neurons(i);
        fprintf(fileID,'Lay: %i Id: %i Thr: %f\n', neuron.layer, neuron.numberInLayer, neuron.threshold);
    end
    fprintf(fileID,'Synapses: %i\n', length(connectome.synapses));
    for i=1:length(connectome.synapses)
        synapse = connectome.synapses(i);
        fprintf(fileID,'InLa: %i InId: %i OuLa: %i OuId: %i W: %f Active: %i DefTim: %f ReTim: %f InMem: %f MemThr: %f DeaThr: %f WithoutUse: %f\n', ...,
            synapse.inputNeuronLayer, synapse.inputNeuronId, synapse.outputNeuronLayer, synapse.outputNeuronId, ...,
            synapse.weight, synapse.active, synapse.definedRechargingTime, synapse.remainingTime, synapse.belongsToMemory, ...
            synapse.memoryThreshold, synapse.deathThreshold, synapse.epochsWithoutUse);
    end
    fclose(fileID);
    
end

